<template>
  <el-dialog v-model="dialogVisible" title="提示" width="500" :before-close="handleClose">
    <span>确认删除吗？</span>
    <template #footer>
      <div class="dialog-footer">
        <el-button @click="dialogVisible = false">取消</el-button>
        <el-button type="primary" @click="confirm">
          确认
        </el-button>
      </div>
    </template>
  </el-dialog>
</template>

<script lang="ts" setup>
import { ref } from 'vue'
import { ElMessageBox } from 'element-plus'

const dialogVisible = ref(false)
const bussiness = ref(0)
const handleClose = (done: () => void) => {
  ElMessageBox.confirm('确认删除?')
    .then(() => {
      done()
    })
    .catch(() => {
    })
}
const $confirm = defineEmits(['confirm']);
const confirm = () => {
  dialogVisible.value = false
  $confirm("confirm", bussiness.value)
}
const open = (id: number) => {
  bussiness.value = id
  dialogVisible.value = true

}
defineExpose({
  open
})
</script>

<style scoped></style>
